/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package proyecto.jpa;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "horario")
@NamedQueries({@NamedQuery(name = "Horario.findAll", query = "SELECT h FROM Horario h"), @NamedQuery(name = "Horario.findByCodigoHorario", query = "SELECT h FROM Horario h WHERE h.horarioPK.codigoHorario = :codigoHorario"), @NamedQuery(name = "Horario.findByMedicocodigoMedico", query = "SELECT h FROM Horario h WHERE h.horarioPK.medicocodigoMedico = :medicocodigoMedico"), @NamedQuery(name = "Horario.findByLocalClinicacodigoLocal", query = "SELECT h FROM Horario h WHERE h.horarioPK.localClinicacodigoLocal = :localClinicacodigoLocal"), @NamedQuery(name = "Horario.findByMedicoEspecialidadcodigoEspecialidad", query = "SELECT h FROM Horario h WHERE h.horarioPK.medicoEspecialidadcodigoEspecialidad = :medicoEspecialidadcodigoEspecialidad"), @NamedQuery(name = "Horario.findByFecha", query = "SELECT h FROM Horario h WHERE h.fecha = :fecha"), @NamedQuery(name = "Horario.findByHoraInicio", query = "SELECT h FROM Horario h WHERE h.horaInicio = :horaInicio"), @NamedQuery(name = "Horario.findByHoraFin", query = "SELECT h FROM Horario h WHERE h.horaFin = :horaFin")})
public class Horario implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected HorarioPK horarioPK;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Column(name = "horaInicio")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaInicio;
    @Column(name = "horaFin")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaFin;

    public Horario() {
    }

    public Horario(HorarioPK horarioPK) {
        this.horarioPK = horarioPK;
    }

    public Horario(int codigoHorario, int medicocodigoMedico, int localClinicacodigoLocal, int medicoEspecialidadcodigoEspecialidad) {
        this.horarioPK = new HorarioPK(codigoHorario, medicocodigoMedico, localClinicacodigoLocal, medicoEspecialidadcodigoEspecialidad);
    }

    public HorarioPK getHorarioPK() {
        return horarioPK;
    }

    public void setHorarioPK(HorarioPK horarioPK) {
        this.horarioPK = horarioPK;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Date getHoraInicio() {
        return horaInicio;
    }

    public void setHoraInicio(Date horaInicio) {
        this.horaInicio = horaInicio;
    }

    public Date getHoraFin() {
        return horaFin;
    }

    public void setHoraFin(Date horaFin) {
        this.horaFin = horaFin;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (horarioPK != null ? horarioPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Horario)) {
            return false;
        }
        Horario other = (Horario) object;
        if ((this.horarioPK == null && other.horarioPK != null) || (this.horarioPK != null && !this.horarioPK.equals(other.horarioPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "proyecto.jpa.Horario[horarioPK=" + horarioPK + "]";
    }

}
